package com.winhxd.b2c.order.dao;

import com.winhxd.b2c.common.domain.order.condition.*;
import com.winhxd.b2c.common.domain.order.model.OrderRebateRecord;
import com.winhxd.b2c.common.domain.order.vo.OrderProfitVO;
import com.winhxd.b2c.common.domain.order.vo.OrderRebateInformationVO;
import com.winhxd.b2c.common.domain.order.vo.OrderRefundRebateVO;
import com.winhxd.b2c.common.domain.order.vo.OrderUsersProfitListVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;
@Repository
public interface OrderRebateRecordMapper {
    int deleteByPrimaryKey(Long id);

    int insert(OrderRebateRecord record);

    int insertSelective(OrderRebateRecord record);

    List<OrderRebateRecord> selectByPrimaryKey(String orderNo);

    int updateByPrimaryKeySelective(OrderRebateRecord record);


    int updateByPrimaryKey(OrderRebateRecord record);

    /**
     * |根据订单号、skuId更新收益状态
     * @param record
     * @return
     */
    int updateStatusByOrderNo(OrderRebateRecord record);
    /**
     * @Author lijianhua
     * @Description //我的线下总收益
     * @Date 16:47 2019/1/9
     * @Param [condition]
     * @return java.math.BigDecimal
     **/
    BigDecimal selectReferralsTotal(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //今日预估
     * @Date 16:48 2019/1/9
     * @Param [condition]
     * @return java.math.BigDecimal
     **/
    BigDecimal selectReferralsTotalToday(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //本周预估
     * @Date 16:48 2019/1/9
     * @Param [condition]
     * @return java.math.BigDecimal
     **/
    BigDecimal selectReferralsTotalWeek(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //本月预估
     * @Date 16:48 2019/1/9
     * @Param [condition]
     * @return java.math.BigDecimal
     **/
    BigDecimal selectReferralsTotalMonth(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //我的总收益
     * @Date 17:03 2019/1/9
     * @Param [condition]
     * @return java.math.BigDecimal
     **/
    BigDecimal selectTotalAgentOne(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //今日预估
     * @Date 17:03 2019/1/9
     * @Param [condition]
     * @return java.math.BigDecimal
     **/
    BigDecimal selectTotalTodayAgentOne(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //本周预估
     * @Date 17:03 2019/1/9
     * @Param [condition]
     * @return java.math.BigDecimal
     **/
    BigDecimal selectTotalWeekAgentOne(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //本月预估
     * @Date 17:04 2019/1/9
     * @Param [condition]
     * @return java.math.BigDecimal
     **/
    BigDecimal selectTotalMonthAgentOne(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //二级分销商我的总收益
     * @Date 17:11 2019/1/9
     * @Param [condition]
     * @return java.math.BigDecimal
     **/
    BigDecimal selectTotalAgentTwo(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //二级分销商今日预估
     * @Date 17:11 2019/1/9
     * @Param [condition]
     * @return java.math.BigDecimal
     **/
    BigDecimal selectTotalTodayAgentTwo(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //二级分销商本周预估
     * @Date 17:12 2019/1/9
     * @Param [condition]
     * @return java.math.BigDecimal
     **/
    BigDecimal selectTotalWeekAgentTwo(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //二级分销商本月预估
     * @Date 17:12 2019/1/9
     * @Param [condition]
     * @return java.math.BigDecimal
     **/
    BigDecimal selectTotalMonthAgentTwo(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //获取一级分销商总收益
     * @Date 9:47 2019/1/10
     * @Param [condition]
     * @return java.util.List<com.winhxd.b2c.common.domain.order.vo.OrderProfitVO>
     **/
    List<OrderProfitVO> selectDistOneOrderProfitSummary(OrderProfitSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //获取二级分销商收益
     * @Date 10:04 2019/1/10
     * @Param [condition]
     * @return java.util.List<com.winhxd.b2c.common.domain.order.vo.OrderProfitVO>
     **/
    List<OrderProfitVO> selectDistTwoOrderProfitSummary(OrderProfitSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //获取一级分销商线下收益列表
     * @Date 10:08 2019/1/10
     * @Param [condition]
     * @return java.util.List<com.winhxd.b2c.common.domain.order.vo.OrderProfitVO>
     **/
    List<OrderProfitVO> selectDistOneOrderReferralsProfitSummary(OrderProfitSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //获取用户预估收益
     * @Date 11:44 2019/1/10
     * @Param [condition]
     * @return java.util.List<com.winhxd.b2c.common.domain.order.vo.OrderUsersProfitListVO>
     **/
    List<OrderUsersProfitListVO> selectOrderUsersProfitList(OrderUsersCondition condition);

    /**
     * 批量更新订单的实际收益
     * @param orderRebateRecordList
     */
    void batchUpdateOrderRebateRecord(@Param("orderRebateRecordList") List<OrderRebateRecord> orderRebateRecordList);

    /**
     * @Author lijianhua
     * @Description //获取用户待转正金额
     * @Date 15:56 2019/1/12
     * @Param [condition]
     * @return java.math.BigDecimal
     **/
    BigDecimal selectWaitingTotal(OrderSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //一级分销商待转正金额
     * @Date 15:57 2019/1/12
     * @Param [condition]
     * @return java.math.BigDecimal
     **/
    BigDecimal selectWaitingTotalAgentOne(OrderSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //二级分销商待转正金额
     * @Date 15:57 2019/1/12
     * @Param [condition]
     * @return java.math.BigDecimal
     **/
    BigDecimal selectWaitingTotalAgentTwo(OrderSummaryCondition condition);
    /**
     * @Author shijinxing
     * @Description 订单管理-订单详情-返利记录
     * @Date 15:57 2019/1/12
     * @Param [condition]
     * @return List<OrderRebateInformationVO>
     **/
    List<OrderRebateInformationVO> selectRebateInformation(OrderRebateInformationCondition condition);

    /**
     *@author: zhangyanwei
     *@date: 2019/1/13 16:30
     *@Description: 退款时根据订单号和SKU修改返利信息
     *@param: [condition]
     *@return: int
     */
    int updateByOrderNoAndSKU(OrderRefundRebateCondition condition);


    /**
     * 根据订单查询奖励信息
     * @param orderNo
     * @return
     */
    List<OrderRebateRecord> selectListByOrderNo(@Param("orderNo") String orderNo);

    /**
     *@author: zhangyanwei
     *@date: 2019/1/14 13:42
     *@Description: 根据订单号和SKU查询返利信息
     *@param: []
     *@return: com.winhxd.b2c.common.domain.order.vo.OrderRefundRebateVO
     */
    OrderRefundRebateVO selectRebateByCondition(OrderRefundRebateCondition condition);

    /**
     *@author: wangxiaoshun
     *@date: 2019/1/15 13:42
     *@Description: 根据订单号和SKU查询返利信息
     *@param: []
     *@return: com.winhxd.b2c.common.domain.order.vo.OrderRefundRebateVO
     */
    OrderRebateRecord selectRebateByOrderNoAndSkuId(@Param("orderNo") String orderNo,@Param("orderNo") Long skuId);
}